﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class admin_AdminOutput : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bindExamAllNameList();
        }
    }

    protected void outputExcel_Click(object sender, EventArgs e)
    {

        string stTime = startTime.Text.Trim();
        string edTime = endTime.Text.Trim();
  
        DataTable dt = Exam.OrderInfo_GetReconcileList(stTime, edTime);
        if (stTime != "" && edTime != "")
        {
            BSUtility.ExportDataTableToExcel(dt,  stTime + "到" + edTime + "订单");
        }
        else
        {
            BSUtility.WindowAlert(Page,"必须选择一个区间导出对帐单");
        }   
    }
    private void bindExamAllNameList()
    {
        DataTable dt = Exam.ExamTime_GetTopList();
        if (dt.Rows.Count > 0)
        {
            if (dt.Columns.Contains("EmTimeValue"))
                dt.Columns.Remove("EmTimeValue");
            dt.Columns.Add("EmTimeValue");
            foreach (DataRow typeName in dt.Rows)
            {
                typeName["EmTimeValue"] = typeName["EmID"].ToString() + "-" + typeName["EmYear"].ToString() + "-" + typeName["EmNum"].ToString();


                //ListItem liType = new ListItem(typeName["EmAllName"].ToString());
                //List_ExamAllName.Items.Add(liType);
            }
            DataRow drAll = dt.NewRow();
            drAll["EmTimeValue"] = "0-0-0";
            drAll["EmAllName"] = "全部";
            dt.Rows.InsertAt(drAll,0);
            BSUtility.BindListControl(ddlExamList, dt, "EmAllName", "EmTimeValue");
        }
    }
}